package com.gec.zhs.controller;

import java.util.List;

import com.gec.zhs.entity.query.FrmleavereqQuery;
import com.gec.zhs.entity.po.Frmleavereq;
import com.gec.zhs.entity.vo.ResponseVO;
import com.gec.zhs.service.FrmleavereqService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * 模拟一个自定页面的表单，该数据会关联到流程实例FrmData，可用于复杂页面的设计及后期的数据分析 Controller
 */
@RestController("frmleavereqController")
@RequestMapping("/frmleavereq")
public class FrmleavereqController extends ABaseController{

	@Resource
	private FrmleavereqService frmleavereqService;
	/**
	 * 根据条件分页查询
	 */
	@RequestMapping("/loadDataList")
	public ResponseVO loadDataList(FrmleavereqQuery query){
		return getSuccessResponseVO(frmleavereqService.findListByPage(query));
	}

	/**
	 * 新增
	 */
	@RequestMapping("/add")
	public ResponseVO add(Frmleavereq bean) {
		frmleavereqService.add(bean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增
	 */
	@RequestMapping("/addBatch")
	public ResponseVO addBatch(@RequestBody List<Frmleavereq> listBean) {
		frmleavereqService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 批量新增/修改
	 */
	@RequestMapping("/addOrUpdateBatch")
	public ResponseVO addOrUpdateBatch(@RequestBody List<Frmleavereq> listBean) {
		frmleavereqService.addBatch(listBean);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id查询对象
	 */
	@RequestMapping("/getFrmleavereqById")
	public ResponseVO getFrmleavereqById(String id) {
		return getSuccessResponseVO(frmleavereqService.getFrmleavereqById(id));
	}

	/**
	 * 根据Id修改对象
	 */
	@RequestMapping("/updateFrmleavereqById")
	public ResponseVO updateFrmleavereqById(Frmleavereq bean,String id) {
		frmleavereqService.updateFrmleavereqById(bean,id);
		return getSuccessResponseVO(null);
	}

	/**
	 * 根据Id删除
	 */
	@RequestMapping("/deleteFrmleavereqById")
	public ResponseVO deleteFrmleavereqById(String id) {
		frmleavereqService.deleteFrmleavereqById(id);
		return getSuccessResponseVO(null);
	}
}